home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util4
/
0utils.lha
/
0Utils
/
Examine.data
< prev
next >
Wrap
Text File
|
1995-08-19
|
3KB
|
117 lines
#ifdef TPLTER
Examine = {
SHORT = {{ Examine a FileSystem object }};
DESCRIPTION = {{
Call the Dos.library function Examine on a
certain Filesystem Object.
RESULT
Outputs the different fields of a struct
FileInfoBlock
}};
NOTES = {{
This command is IMHO senseless for everyday
usage - it does only make sense, if s.o. wants
to look inside certain structures ...
(I needed it when playing w/ a ramdisk)
}};
EXAMPLES = {{
>Examine SYS:S
DiskKey = 0x2BA7;
DirEntryType= 2; /* ST_USERDIR *\
FileName = "S";
Protection = "------------rwed";
EntryType = 2; /* ST_USERDIR *\
Size = 0;
NumBlocks = 1;
Comment = "";
OwnerUID = 0x00000000;
OwnerGID = 0x00000000;
}};
HISTORY = {{
25-03-95 b_noll created
19-08-95 b_noll created .data file
}};
Template = "PATH/A";
Arguments = {{
STRPTR path;
}};
version = "1.0";
body = {{
{
BPTR lock;
if (lock = Lock(argv->path, SHARED_LOCK)) {
struct FileInfoBlock *fib;
if (fib = AllocDosObject(DOS_FIB, NULL)) {
if (Examine (lock, fib)) {
STRPTR det[] = {
"ST_PIPEFILE", "ST_LINKFILE", "ST_FILE",
"?", "?", "?",
"ST_ROOT", "ST_USERDIR", "ST_SOFTLINK",
"ST_LINKDIR"
};
UBYTE prot[] = "rwedrwed-sparwed";
{
LONG i,p;
# define MAXMBIT 15
# define MINMBIT 4
# define MAXUBIT 3
# define MINUBIT 0
p = fib->fib_Protection;
for (i = MAXMBIT; i >= MINMBIT; -- i)
if (!(p & (1 << i)))
prot[MAXMBIT - i] = '-';
for (i = MAXUBIT; i >= MINUBIT; -- i)
if ((p & (1 << i)))
prot[MAXMBIT - i] = '-';
}
Printf("DiskKey = 0x%04lx;\n"
"DirEntryType= %ld; /* %s */\n"
"FileName = \"%s\";\n"
"Protection = \"%s\";\n"
"EntryType = %ld; /* %s */\n"
"Size = %ld;\n"
"NumBlocks = %ld;\n"
"Comment = \"%s\";\n"
"OwnerUID = 0x%04lx;\n"
"OwnerGID = 0x%04lx;\n"
,
fib->fib_DiskKey,
fib->fib_DirEntryType, det[fib->fib_DirEntryType+5],
fib->fib_FileName,
/*fib->fib_Protection, */ prot,
fib->fib_EntryType, det[fib->fib_EntryType+5],
fib->fib_Size,
fib->fib_NumBlocks,
fib->fib_Comment,
fib->fib_OwnerUID,
fib->fib_OwnerGID,
0);
} /* if */
FreeDosObject(DOS_FIB, fib);
} /* if */
UnLock(lock);
} /* if */
}
}};
};
#endif